
<%@page import="org.ddr.board.BoardVO"%>
<%@page import="org.ddr.board.dao.BbsDAO"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    
<%	
	String pageno = request.getParameter("pageno");
	if (pageno == null) pageno = "1";
	
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>

 <style type="text/css">
 
.list_table {width:100%}
.list_table tbody td { text-align: center;  border-bottom: 1px solid #e5e5e5; padding: 5px; 
font-size:10pt;}

a { text-decoration:none }
 </style>
</head>
<body>

		<table class="list_table" width="600">
		<h2>
		<caption >3조 게시판</caption>
		</h2>
		<colgroup>
			<col width="15%" />
			<col width="35%" />
			<col width="15%" />
			<col width="15%" />
			<col width="20%" />
			
		</colgroup>	
		<tbody>
		<tr>
			<th> 글번호 </th>
			<th> 제목 </th>
			<th> 작성자 </th>
			<th> 조회수</th>
			<th> 날짜</th>
		</tr>
		<tr height="4" bgcolor="#e5e5e5"><td colspan="12">
		</tr>
		<%
		List<BoardVO> list = new ArrayList<BoardVO>();
		list = BbsDAO.instance.read(Integer.parseInt(pageno));
		
		Double totalCnt = 0D;
		boolean flag = true;
		for(BoardVO vo : list) {
			if (flag)
				totalCnt  = vo.getTotalCnt();
		%>
		<tr>
			<td><%=vo.getBbsNo()%></td>
			<td style="text-align:left"><a href="boardcontent.jsp?bbsno=<%=vo.getBbsNo()%>" ><%=vo.getTitle()%>(<%=vo.getReplyCount()%>)</a></td>
			<td><%=vo.getUserId()%></td>
			<td><%=vo.getReadCount()%></td>
			<td><%=vo.getWriteDate()%></td>
		</tr>
			<%} %>
	</table>	
	<table align=center>
		<tr>
			<td align=center>
				<% 					
					Integer checkPage = (int)(Math.ceil((Double.parseDouble(pageno)/10))*100+1);
					for(int i=(checkPage/10)-9; i<(totalCnt/10) + 1; i++) {
					out.write ("[<a href = 'boardlist.jsp?pageno="+i+"'>"+i+"</a>]");	
		}
				%>
			</td>
		</tr>
		<tr>
			<td align=center>
	    		<a href = "inputboard.jsp">글쓰기</a>
	    	</td>
		</tr>
	</table>
</body>
</html>
















